<?php
session_start();
$user=$_SESSION["username"];
require("conn.php");
$ten=$_POST["ten"];
//$chude=$_POST["chude"];
$mota=$_POST["mota"];
$motact=$_POST["mota"];
$tenfile=$_FILES["tenfile"]["name"];
$sql="INSERT INTO `ajax`.`fileupload` (`ma`, `ten`, `chude`, `mathanhvien`, `mota`, `motact`, `hinh`, `sodownload`) VALUES (NULL, '$ten', 'chude', '$user', '$mota', '$motact', '$tenfile', '0')";
/*if (($_FILES["tenfile"]["type"] =="image/gif")
|| ($_FILES["tenfile"]["type"] == "image/jpeg")
|| ($_FILES["tenfile"]["type"] == "image/pjpeg"))
{
echo("rar");
}*/
		if(move_uploaded_file($_FILES["tenfile"]["tmp_name"],"uploadfile/".$tenfile))
		{
			mysql_query($sql);
			echo("thanh cong");
			//header("location:index.php");
		}
		else
		{
		echo("k thanh cong");
		}

?>